# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=libksieve
pkgver=23.08.4
pkgrel=0
pkgdesc="KDE PIM library for managing sieves"
# armhf blocked by extra-cmake-modules
# ppc64le, s390x and riscv64 blocked by qt5-qtwebengine
arch="all !armhf !ppc64le !s390x !riscv64"
url="https://kontact.kde.org/"
license="GPL-2.0-only"
depends_dev="
	karchive5-dev
	kdoctools5-dev
	ki18n5-dev
	kiconthemes5-dev
	kidentitymanagement-dev
	kimap-dev
	kio5-dev
	kmailtransport-dev
	kmime-dev
	knewstuff5-dev
	kpimtextedit-dev
	kwindowsystem5-dev
	libkdepim-dev
	pimcommon-dev
	qt5-qtbase-dev
	qt5-qtwebengine-dev
	syntax-highlighting5-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	samurai
	"
checkdepends="xvfb-run"
_repo_url="https://invent.kde.org/pim/libksieve.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/libksieve-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_QCH=ON
	cmake --build build
}

check() {
	# libksieveui-findbar-findbarbasetest, sieveeditorhelphtmlwidgettest and sieveeditor-autocreatescripts-sieveeditorgraphicalmodewidgettest require OpenGL
	xvfb-run ctest --test-dir build --output-on-failure -E "(libksieveui-findbar-findbarbase|sieveeditorhelphtmlwidget|sieveeditor-autocreatescripts-sieveeditorgraphicalmodewidget)test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
b7a762355da38e98c15df2f286ebc214cbff62a7463acdc0d0d4587358ece8b912f4d099b7fa06eaa51e44748237c91ebca07e3ab6388a11d672fd9b33b6201e  libksieve-23.08.4.tar.xz
"
